package com.ce.pms.customer.vo;

import java.util.Set;

import com.ce.pms.common.web.ICacheManage;
import com.sitechasia.webx.core.model.IViewObject;

/**
 * 功能描述: 住户房屋信息ViewObject类
 * 在这个类中包含有
 * <ol>
 * <li>客户所拥有的房屋信息</li>
 * <li>产权信息</li>
 * <li>与本房间有产权共享关系的其他房间id的集合</li>
 * <li>房屋划款银行账号信息</li>
 * </ol>
 * <p>
 * 版权所有：中企动力
 * <p>
 * 未经本公司许可，不得以任何方式复制或使用本程序任何部分
 *
 * @author 付湘辉 Created on 2008-05-22
 */
public class CustomerHouseVO implements IViewObject, ICacheManage<CustomerHouseVO>{

	/**
	 * long：serialVersionUID
	 */
	private static final long serialVersionUID = -8050573952267760585L;

	/**
	 * 开户人
	 */
	private String accountOwner;

	/**
	 * 银行id
	 */
	private Long bankId;

	/**
	 * 银行名称
	 */
	private String bankName;

	/**
	 * 银行帐号
	 */
	private String bankNumber;

	/**
	 * 银行合同号
	 */
	private String contactNumber;

	/**
	 * 操作人id
	 */
	private Long creator;

	/**
	 * saved 代表已保存过 unsave 代表还没有保存过
	 *
	 * @see CustomerVO
	 */
	private String hasSave;

	/**
	 * 房屋买卖合同
	 */
	private String houseContractNumber;

	/**
	 * 房间id
	 */
	private Long houseId;

	/**
	 * 房号
	 */
	private String houseNumber;

    /**
	 * 产权证号
	 */
	private String housePropertyNo;

	/**
	 * 记帐策略(1分开记帐;0合并记帐)
	 */
	private String chargeSelect;

    /**
	 * 缓存索引位置
	 */
	private Integer index;

	/**
     * 是否管理房 1是 0否
     */
    private String isVirtual;

    /**
     * 所属管理房id
     */
    private Long manageHouseId;

	/**
	 * add 新增 edit 修改 delete 删除 done 已保存
	 */
	private String opratorStatus;

	/**
	 * 业主姓名(此字段针对租户住房信息)
	 */
	private String ownerName;

	/**
	 * 建设期id
	 */
	private Long projectId;

    /**
     * 与本房间有产权共享关系的其他房间id的集合
     */
    private Set<Long> proRightShareHouseIds;

	/**
	 * @roseuid 4833F48000EA
	 */
	public CustomerHouseVO() {

	}

	/**
	 * 功能描述：构造一个与业主相关的住房信息
	 * @param houseId
	 * @param houseNumber
	 * @param houseContractNumber
	 * @param housePropertyNo
	 * @param bankId
	 * @param bankNumber
	 * @param accountOwner
	 * @param bankName
	 * @param opratorStatus
	 * @param hasSave
	 * @param index
	 */
	public CustomerHouseVO(Long houseId, String houseNumber,
			String houseContractNumber, String housePropertyNo, Long bankId,
			String bankNumber, String accountOwner, String bankName,
			String opratorStatus, String hasSave, Integer index) {
		super();
		this.houseId = houseId;
		this.houseNumber = houseNumber;
		this.houseContractNumber = houseContractNumber;
		this.housePropertyNo = housePropertyNo;
		this.bankId = bankId;
		this.bankNumber = bankNumber;
		this.accountOwner = accountOwner;
		this.bankName = bankName;
		this.opratorStatus = opratorStatus;
		this.hasSave = hasSave;
		this.index = index;
	}

	/**
	 * 功能描述：构造一个与租户相关的住房信息
	 * @param houseId
	 * @param houseNumber
	 * @param ownerName
	 * @param opratorStatus
	 * @param hasSave
	 * @param index
	 */
	public CustomerHouseVO(Long houseId, String houseNumber, String ownerName,
			String opratorStatus, String hasSave, Integer index) {
		super();
		this.houseId = houseId;
		this.houseNumber = houseNumber;
		this.ownerName = ownerName;
		this.opratorStatus = opratorStatus;
		this.hasSave = hasSave;
		this.index = index;
	}

	/**
	 * 功能描述: 比较索引大小确定排序，索引越大越靠前
	 *
	 * @author 付湘辉
	 * Created on:2008-6-5
	 *
	 * 修改原因：
	 * @return 如果指定对象索引小于、等于或大于该对象的索引，则分别返回负整数、零或正整数。
	 */
	public int compareTo(CustomerHouseVO o) {
		Integer another = o.getIndex();
		Integer thisIndex = this.index;
		another = another == null ? 0 : another;
		thisIndex = thisIndex == null ? 0 : thisIndex;
		return another - thisIndex;
	}

	@Override
	public boolean equals(Object obj) {

		if (obj==null || !(obj instanceof CustomerHouseVO)) {
			return false;
		}
		CustomerHouseVO chvo = (CustomerHouseVO)obj;
		Long houseId = chvo.getHouseId();
		String houseNo = chvo.getHouseNumber();
		Integer index = chvo.getIndex();

		if(this.index!=null){
			return this.index.equals(index);
		} else if (this.houseId != null) {
			return this.houseId.equals(houseId);
		} else if (this.houseNumber != null) {
			return this.houseNumber.equalsIgnoreCase(houseNo);
		}

		return false;
	}

	public String getAccountOwner() {
		return this.accountOwner;
	}

	public Long getBankId() {
		return this.bankId;
	}

	public String getBankName() {
		return this.bankName;
	}

	public String getBankNumber() {
		return this.bankNumber;
	}

	/**
	 * 功能描述: 获取操作人id
	 *
	 * @author 付湘辉
	 * Created on:2008-6-10
	 *
	 * 修改原因：
	 * @return 返回结果
	 */
	public Long getCreator() {
		return this.creator;
	}

	public String getHasSave() {
		return this.hasSave;
	}

	public String getHouseContractNumber() {
		return this.houseContractNumber;
	}

	public Long getHouseId() {
		return this.houseId;
	}

	public String getHouseNumber() {
		return this.houseNumber;
	}

	public String getHousePropertyNo() {
		return this.housePropertyNo;
	}

	public Integer getIndex() {
		return this.index;
	}

	/**
     * 功能描述: 获取isVirtual
     *
     * @author 付湘辉
     * Created on:2008-7-27
     */
    public String getIsVirtual() {
        return this.isVirtual;
    }

	public String getOpratorStatus() {
		return this.opratorStatus;
	}

	public String getOwnerName() {
		return this.ownerName;
	}

	/**
	 * @return the projectId
	 */
	public Long getProjectId() {
		return this.projectId;
	}

	/**
     * 功能描述: 获取proRightShareHouseIds,
     * 这是一个与本房屋在同一个管理房下的产权房id的集合，包含它本身的id
     *
     * @author 付湘辉
     * Created on:2008-7-27
     */
    public Set<Long> getProRightShareHouseIds() {
        return this.proRightShareHouseIds;
    }

	public void setAccountOwner(String accountOwner) {
		this.accountOwner = accountOwner;
	}

	public void setBankId(Long bankId) {
		this.bankId = bankId;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	public void setBankNumber(String bankNumber) {
		this.bankNumber = bankNumber;
	}

	/**
	 * 功能描述: 设置操作人id
	 *
	 * @author 付湘辉
	 * Created on:2008-6-10
	 *
	 * 修改原因：
	 * @param creator the 操作人id to set
	 */
	public void setCreator(Long creator) {
		this.creator = creator;
	}

	public void setHasSave(String hasSave) {
		this.hasSave = hasSave;
	}

	/**
	 * 设置房屋买卖(预售)合同号
	 * @param houseContractNumber
	 */
	public void setHouseContractNumber(String houseContractNumber) {
		this.houseContractNumber = houseContractNumber;
	}

	public void setHouseId(Long houseId) {
		this.houseId = houseId;
	}

	public void setHouseNumber(String houseNumber) {
		this.houseNumber = houseNumber;
	}

	public void setHousePropertyNo(String housePropertyNo) {
		this.housePropertyNo = housePropertyNo;
	}

	public void setIndex(Integer index) {
		this.index = index;
	}

	/**
     * 功能描述: 设置isVirtual
     *
     * @author 付湘辉
     * Created on:2008-7-27
     */
    public void setIsVirtual(String isVirtual) {
        this.isVirtual = isVirtual;
    }

    public void setOpratorStatus(String opratorStatus) {
		this.opratorStatus = opratorStatus;
	}

    public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

    /**
	 * @param projectId the projectId to set
	 */
	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

    /**
     * 功能描述: 设置与本房间有产权共享关系的其他房间id的集合
     *
     * @author 付湘辉
     * Created on:2008-7-27
     */
    public void setProRightShareHouseIds(Set<Long> proRightShareHouseIds) {
        this.proRightShareHouseIds = proRightShareHouseIds;
    }

	/**
	 * @return the contactNumber
	 */
	public String getContactNumber() {
		return contactNumber;
	}

	/**
	 * @param contactNumber the contactNumber to set
	 */
	public void setContactNumber(String contactNumber) {
		this.contactNumber = contactNumber;
	}

	public String getChargeSelect() {
		return chargeSelect;
	}

	public void setChargeSelect(String chargeSelect) {
		this.chargeSelect = chargeSelect;
	}

	public Long getManageHouseId() {
		return manageHouseId;
	}

	public void setManageHouseId(Long manageHouseId) {
		this.manageHouseId = manageHouseId;
	}
}
